#include <stdint.h>
#include <stdio.h>

#ifndef MUK_CORE
#define MUK_CORE

#include <k_api.h>
#include <log.h>

/**
 * Key Config
 */
#define KEY_LAYOUT_MAXSIZE 6
#define KEY_ROW_MAXSIZE 8
#define KEY_COL_MAXSIZE 20 

/**
 * Key Pins List object
 */
typedef enum {
    MKU_COL_SCAN = 0u,
    MKU_ROW_SCAN = 1u,
    MKU_BACKLIGH_ON = 2u,
    MKU_BACKLIGH_OFF = 3u,
    MKU_KV_INIT = 4u,
    MKU_CLI_INIT = 5u,
} mku_mode_t;
/**
 * Key Pins List object
 */
typedef enum {
    MKU_SUCCESS = 0u,
    MKU_MATRIX_ERR,
} mku_stat_t;

/**
 * IO Pins List object
 */
typedef struct pin_list_s {
    /**<
     *  Keymap Matrix Strucr
     *  List head is this mutex, list node is task, which are blocked in this
     *
     */
    uint8_t len;
    uint8_t *pins;
} pin_list_t;

/**
 * keymap object
 */
typedef struct keymap_s {
    /**<
     *  Keymap Matrix Strucr
     *  List head is this mutex, list node is task, which are blocked in this
     * mutex
     */
    uint8_t layout;
    uint8_t row;
    uint8_t col;
    uint8_t *default_keymap; /** codes for the default keys */
    uint8_t *raise_keymap;   /** codes for the shift keys */
} keymap_t;

/**
 * key macro object
 */
typedef struct key_macro_s {
    /**<
     *  Keymap Matrix Strucr
     *  List head is this mutex, list node is task, which are blocked in this
     * mutex
     */
    uint8_t layout;
    uint8_t *active_keys;
    uint8_t *key_codes; /** codes for the keys */
} key_macro_t;

/**
 * key super macro object
 */
typedef struct key_super_macro_s {
    /**<
     *  Keymap Matrix Strucr
     *  List head is this mutex, list node is task, which are blocked in this
     * mutex
     */
    uint8_t layout;
    uint8_t *active_keys;
    uint8_t *key_codes; /** codes for the keys */
} key_super_macro_t;

#endif